<template>
  <div class="editor-ad-con">
      
      <!-- <div class="ad-con-title">显示方式:
        <RadioGroup v-model="animal" @on-change="rchange">
          <Radio label="1">折叠轮播</Radio>
          <Radio label="2">单张展示</Radio>
      </RadioGroup>
    </div>
      <div class="ad-con-title">显示大小:
         <RadioGroup v-model="anima2">
              <Radio label="1">大图</Radio>
              <Radio label="2" v-if="animal==2">小图</Radio>
          </RadioGroup>
      </div> -->
      <div class="ad-con-imgbox" v-for="(item,index) in data.datalist">
          <div class="ad-con-imgbox-lbox">
            <img :src="item.url" alt="">
          </div>
          <div class="ad-con-imgbox-rbox">
               <div class="ad-con-title">标题&nbsp
                  <Input @on-change="inputChanges(item.title,index)" v-model="item.title" placeholder="最多20个字" :maxlength="20" style="width: 150px" />
              </div>
              <div class="ad-con-title">链接&nbsp
                  <Select @on-change="selectChanges"  v-model="item.link" style="width: 150px">
                    <Option  value="1">无</Option >
                  </Select >
              </div>
          </div>
      </div>
      <div class="ad-con-addImg" @click="addad(data.selfindex)">
            <Icon type="md-add-circle" /> &nbsp添加一个广告
      </div>
  </div>
</template>

<script>

export default {
  props:{
    data:{
      type:Object,
      default:()=>{
        return{
          active:true,
          datalist:[],
          style:{
            height:"200px"
          }
        }
      }
    }
  },
  name: 'ad',
  data () {
    return {
      value:"",
      animal:"1",
      lianji:"1",
      anima2:"1",
      msg: '广告  暂时分为轮播和单张展示两种'

    }
  },
  methods:{
    addad(d){
      this.control(d)
    },
    inputChanges(e,index){

   var data = {title:e,index:index}
      this.$emit('on-change',data)
    },
    selectChanges(e){
         var data = {link:e}
        this.$emit('on-change',data)
    },
    control(d){
      var  url ="http://tu.duia.com/yypic/166056072297036148.png"
        var data = {url:url,index:d}
        this.$emit('on-change',data)
    },
    rchange(e){
        if(e==1){
          this.anima2="1"
        }
    }
  },
    components:{
       
    }
}
</script>
